package com.xingfudazi.app.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xingfudazi.app.enums.MemberTypeEnum;
import com.xingfudazi.common.annotation.Excel;
import lombok.Data;

import java.time.LocalDateTime;

/**
 * 账号对象 app_account
 * 
 * @author ruoyi
 * @date 2024-06-21
 */
@Data
public class AppAccount
{
    private static final long serialVersionUID = 1L;

    /** $column.columnComment */
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    /** 用户名 */
    @Excel(name = "用户名")
    private String username;

    /** 密码 */
    @Excel(name = "密码")
    private String password;

    /** 手机号 */
    @Excel(name = "手机号")
    private String phone;

    /** 昵称 */
    @Excel(name = "昵称")
    private String nikcName;

    /** wx_open_id */
    @Excel(name = "wx_open_id")
    private String wxOpenId;

    /** wx_union_id */
    @Excel(name = "wx_union_id")
    private String wxUnionId;

    /** 删除标志 */
    @TableField(fill = FieldFill.INSERT,value = "del_flag")
    private String delFlag;

    /**
     * 记录上次登陆的 账号类型
     */
    private String memberType;


    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT,value = "create_time")
    private LocalDateTime createTime;

    public void initPhone(String phone) {
        this.username = phone;
        this.phone = phone;
        this.nikcName= phone;
        this.memberType = MemberTypeEnum.MEMBER.name();
    }

    public static void main(String[] args) {
        System.out.println(System.currentTimeMillis());
    }
}
